class AppUserInfoModelTeam {
/*
{
  "direct_users_count": 4,
  "indirect_users_count": 6,
  "today_new_team_users_count": 0,
  "today_new_users_count": 0
}
*/

  int? directUsersCount;
  int? indirectUsersCount;
  int? todayNewTeamUsersCount;
  int? todayNewUsersCount;

  AppUserInfoModelTeam({
    this.directUsersCount,
    this.indirectUsersCount,
    this.todayNewTeamUsersCount,
    this.todayNewUsersCount,
  });

  AppUserInfoModelTeam.fromJson(Map<String, dynamic> json) {
    directUsersCount = json['direct_users_count']?.toInt();
    indirectUsersCount = json['indirect_users_count']?.toInt();
    todayNewTeamUsersCount = json['today_new_team_users_count']?.toInt();
    todayNewUsersCount = json['today_new_users_count']?.toInt();
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['direct_users_count'] = directUsersCount;
    data['indirect_users_count'] = indirectUsersCount;
    data['today_new_team_users_count'] = todayNewTeamUsersCount;
    data['today_new_users_count'] = todayNewUsersCount;
    return data;
  }
}

class AppUserInfoModelUser {
/*
{
  "id": 28,
  "created_at": "2025-07-19T13:36:44.335+08:00",
  "updated_at": "2025-09-09T18:20:22.148+08:00",
  "deleted_at": null,
  "identity": "U169663488",
  "username": "level1",
  "avatar": "/uploads/20250718/fc3adfa33ee8456293234f9762938610.png",
  "invite_code": "D2QXFNQ",
  "invited_by": "",
  "status": 1,
  "last_login_at": "2025-09-09T18:20:22.148202875+08:00",
  "register_ip": "192.168.1.249",
  "last_login_ip": "103.90.138.16",
  "notice_forbidden_date": "2025-09-04",
  "rebate_rate": 4000,
  "recharge_address": "TSDT2zu4gokWkuuF1pT2WySympoHMGKG6J",
  "withdraw_address": "",
  "user_wallet": null,
  "invited_users": null,
  "member_count": 4,
  "question_id": 1,
  "question": null,
  "answer_notice": "2",
  "safety_score": 100,
  "has_bind_trc20_address": true,
  "has_set_fund_password": true,
  "has_set_security_question": true,
  "first_level": 0,
  "second_level": 0,
  "third_level": 0,
  "invited_path": "",
  "forbid_page_bet": false,
  "forbid_page_reward": false,
  "forbid_transfer_reward": false,
  "username_updated_at": ""
}
*/

  int? id;
  String? createdAt;
  String? updatedAt;
  String? deletedAt;
  String? identity;
  String? username;
  String? avatar;
  String? inviteCode;
  String? invitedBy;
  int? status;
  String? lastLoginAt;
  String? registerIp;
  String? lastLoginIp;
  String? noticeForbiddenDate;
  int? rebateRate;
  String? rechargeAddress;
  String? withdrawAddress;
  String? userWallet;
  String? invitedUsers;
  int? memberCount;
  int? questionId;
  String? question;
  String? answerNotice;
  int? safetyScore;
  bool? hasBindTrc20Address;
  bool? hasSetFundPassword;
  bool? hasSetSecurityQuestion;
  int? firstLevel;
  int? secondLevel;
  int? thirdLevel;
  String? invitedPath;
  bool? forbidPageBet;
  bool? forbidPageReward;
  bool? forbidTransferReward;
  String? usernameUpdatedAt;

  AppUserInfoModelUser({
    this.id,
    this.createdAt,
    this.updatedAt,
    this.deletedAt,
    this.identity,
    this.username,
    this.avatar,
    this.inviteCode,
    this.invitedBy,
    this.status,
    this.lastLoginAt,
    this.registerIp,
    this.lastLoginIp,
    this.noticeForbiddenDate,
    this.rebateRate,
    this.rechargeAddress,
    this.withdrawAddress,
    this.userWallet,
    this.invitedUsers,
    this.memberCount,
    this.questionId,
    this.question,
    this.answerNotice,
    this.safetyScore,
    this.hasBindTrc20Address,
    this.hasSetFundPassword,
    this.hasSetSecurityQuestion,
    this.firstLevel,
    this.secondLevel,
    this.thirdLevel,
    this.invitedPath,
    this.forbidPageBet,
    this.forbidPageReward,
    this.forbidTransferReward,
    this.usernameUpdatedAt,
  });

  AppUserInfoModelUser.fromJson(Map<String, dynamic> json) {
    id = json['id']?.toInt();
    createdAt = json['created_at']?.toString();
    updatedAt = json['updated_at']?.toString();
    deletedAt = json['deleted_at']?.toString();
    identity = json['identity']?.toString();
    username = json['username']?.toString();
    avatar = json['avatar']?.toString();
    inviteCode = json['invite_code']?.toString();
    invitedBy = json['invited_by']?.toString();
    status = json['status']?.toInt();
    lastLoginAt = json['last_login_at']?.toString();
    registerIp = json['register_ip']?.toString();
    lastLoginIp = json['last_login_ip']?.toString();
    noticeForbiddenDate = json['notice_forbidden_date']?.toString();
    rebateRate = json['rebate_rate']?.toInt();
    rechargeAddress = json['recharge_address']?.toString();
    withdrawAddress = json['withdraw_address']?.toString();
    userWallet = json['user_wallet']?.toString();
    invitedUsers = json['invited_users']?.toString();
    memberCount = json['member_count']?.toInt();
    questionId = json['question_id']?.toInt();
    question = json['question']?.toString();
    answerNotice = json['answer_notice']?.toString();
    safetyScore = json['safety_score']?.toInt();
    hasBindTrc20Address = json['has_bind_trc20_address'];
    hasSetFundPassword = json['has_set_fund_password'];
    hasSetSecurityQuestion = json['has_set_security_question'];
    firstLevel = json['first_level']?.toInt();
    secondLevel = json['second_level']?.toInt();
    thirdLevel = json['third_level']?.toInt();
    invitedPath = json['invited_path']?.toString();
    forbidPageBet = json['forbid_page_bet'];
    forbidPageReward = json['forbid_page_reward'];
    forbidTransferReward = json['forbid_transfer_reward'];
    usernameUpdatedAt = json['username_updated_at']?.toString();
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['created_at'] = createdAt;
    data['updated_at'] = updatedAt;
    data['deleted_at'] = deletedAt;
    data['identity'] = identity;
    data['username'] = username;
    data['avatar'] = avatar;
    data['invite_code'] = inviteCode;
    data['invited_by'] = invitedBy;
    data['status'] = status;
    data['last_login_at'] = lastLoginAt;
    data['register_ip'] = registerIp;
    data['last_login_ip'] = lastLoginIp;
    data['notice_forbidden_date'] = noticeForbiddenDate;
    data['rebate_rate'] = rebateRate;
    data['recharge_address'] = rechargeAddress;
    data['withdraw_address'] = withdrawAddress;
    data['user_wallet'] = userWallet;
    data['invited_users'] = invitedUsers;
    data['member_count'] = memberCount;
    data['question_id'] = questionId;
    data['question'] = question;
    data['answer_notice'] = answerNotice;
    data['safety_score'] = safetyScore;
    data['has_bind_trc20_address'] = hasBindTrc20Address;
    data['has_set_fund_password'] = hasSetFundPassword;
    data['has_set_security_question'] = hasSetSecurityQuestion;
    data['first_level'] = firstLevel;
    data['second_level'] = secondLevel;
    data['third_level'] = thirdLevel;
    data['invited_path'] = invitedPath;
    data['forbid_page_bet'] = forbidPageBet;
    data['forbid_page_reward'] = forbidPageReward;
    data['forbid_transfer_reward'] = forbidTransferReward;
    data['username_updated_at'] = usernameUpdatedAt;
    return data;
  }
}

class AppUserInfoModel {
/*
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoyOCwidXNlcm5hbWUiOiJsZXZlbDEiLCJpbnZpdGVfY29kZSI6IkQyUVhGTlEiLCJpZGVudGl0eSI6IlUxNjk2NjM0ODgiLCJleHAiOjE3NTc0OTk2MjJ9._0D-_Ic7oLbXvHM2NgtMdPzwtRTNA-F4xjp_lpsKWLg",
  "user": {
    "id": 28,
    "created_at": "2025-07-19T13:36:44.335+08:00",
    "updated_at": "2025-09-09T18:20:22.148+08:00",
    "deleted_at": null,
    "identity": "U169663488",
    "username": "level1",
    "avatar": "/uploads/20250718/fc3adfa33ee8456293234f9762938610.png",
    "invite_code": "D2QXFNQ",
    "invited_by": "",
    "status": 1,
    "last_login_at": "2025-09-09T18:20:22.148202875+08:00",
    "register_ip": "192.168.1.249",
    "last_login_ip": "103.90.138.16",
    "notice_forbidden_date": "2025-09-04",
    "rebate_rate": 4000,
    "recharge_address": "TSDT2zu4gokWkuuF1pT2WySympoHMGKG6J",
    "withdraw_address": "",
    "user_wallet": null,
    "invited_users": null,
    "member_count": 4,
    "question_id": 1,
    "question": null,
    "answer_notice": "2",
    "safety_score": 100,
    "has_bind_trc20_address": true,
    "has_set_fund_password": true,
    "has_set_security_question": true,
    "first_level": 0,
    "second_level": 0,
    "third_level": 0,
    "invited_path": "",
    "forbid_page_bet": false,
    "forbid_page_reward": false,
    "forbid_transfer_reward": false,
    "username_updated_at": ""
  }
}
*/

  String? token;
  AppUserInfoModelUser? user;
  AppUserInfoModelTeam? team;

  AppUserInfoModel({
    this.token,
    this.user,
  });

  AppUserInfoModel.fromJson(Map<String, dynamic> json) {
    token = json['token']?.toString();
    user = (json['user'] != null)
        ? AppUserInfoModelUser.fromJson(json['user'])
        : null;
    team = (json['team'] != null)
        ? AppUserInfoModelTeam.fromJson(json['team'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['token'] = token;
    if (user != null) {
      data['user'] = user!.toJson();
    }
    if (team != null) {
      data['team'] = team!.toJson();
    }
    return data;
  }
}
